﻿using System;
using System.ComponentModel.DataAnnotations;
using NetBay.Core.BusinessEntities.Resources;

namespace NetBay.Core.BusinessEntities
{
    public class IndexValue : IEquatable<IndexValue>
    {
        public long Identifier { get; set; }
        public int Rank { get; set; }

        [Required(ErrorMessageResourceType = typeof(Global), ErrorMessageResourceName = "NameRequired")]
        public string Name { get; set; }

        public bool Equals(IndexValue other)
        {
            if (Object.ReferenceEquals(other, null)) return false;
            if (Object.ReferenceEquals(this, other)) return true;
            return Identifier.Equals(other.Identifier);
        }

        public override int GetHashCode()
        {
           return Identifier.GetHashCode();
        }
    }
}